home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / pdftops / xpdf / h / Page < prev    next >
Text File  |  1996-06-08  |  2KB  |  93 lines

  1. //========================================================================
  2. //
  3. // Page.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef PAGE_H
  10. #define PAGE_H
  11.  
  12. #ifdef __GNUC__
  13. //#pragma interface
  14. #endif
  15.  
  16. #include "Object.h"
  17.  
  18. class Dict;
  19. class XRef;
  20. class OutputDev;
  21. class PSOutput;
  22.  
  23. //------------------------------------------------------------------------
  24. // PageAttrs
  25. //------------------------------------------------------------------------
  26.  
  27. class PageAttrs {
  28. public:
  29.  
  30.   // Construct a new PageAttrs object by merging a dictionary
  31.   // (of type Pages or Page) into another PageAttrs object.  If
  32.   // <attrs> is NULL, uses defaults.
  33.   PageAttrs(PageAttrs *attrs, Dict *dict);
  34.  
  35.   // Accessors.
  36.   int getX1() { return x1; }
  37.   int getY1() { return y1; }
  38.   int getX2() { return x2; }
  39.   int getY2() { return y2; }
  40.   int getRotate() { return rotate; }
  41.  
  42. private:
  43.  
  44.   int x1, y1, x2, y2;
  45.   int rotate;
  46. };
  47.  
  48. //------------------------------------------------------------------------
  49. // Page
  50. //------------------------------------------------------------------------
  51.  
  52. class Page {
  53. public:
  54.  
  55.   // Constructor.
  56.   Page(int num1, Dict *pageDict, PageAttrs *attrs1);
  57.  
  58.   // Destructor.
  59.   ~Page();
  60.  
  61.   // Is page valid?
  62.   GBool isOk() { return ok; }
  63.  
  64.   // Get page size.
  65.   int getWidth() { return attrs->getX2() - attrs->getX1(); }
  66.   int getHeight() { return attrs->getY2() - attrs->getY1(); }
  67.  
  68.   // Get font dictionary.
  69.   Dict *getFontDict()
  70.     { return fontDict.isDict() ? fontDict.getDict() : (Dict *)NULL; }
  71.  
  72.   // Get annotations array.
  73.   Object *getAnnots(Object *obj) { return annots.fetch(obj); }
  74.  
  75.   // Display a page.
  76.   void display(OutputDev *out, int dpi, int rotate);
  77.  
  78.   // Generate PostScript for a page.
  79.   void genPostScript(PSOutput *psOut, int dpi, int rotate);
  80.  
  81. private:
  82.  
  83.   int num;            // page number
  84.   PageAttrs *attrs;        // page attributes
  85.   Object fontDict;        // font dictionary
  86.   Object xObjDict;        // XObject dictionary
  87.   Object annots;        // annotations array
  88.   Object contents;        // page contents
  89.   GBool ok;            // true if page is valid
  90. };
  91.  
  92. #endif
  93.